<%@page import="com.zkingsoft.constance.SystemConstance"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<c:set var="plat_factory" value="<%=SystemConstance.PLAT_FACTORY%>" />
<c:set var="plat_hotel" value="<%=SystemConstance.PLAT_HOTEL%>" />
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<!-- 视口标签 -->
<meta name="divport"
	content="width=device-width, initial-scale=1, user-scalable=no" />
<!-- 删除苹果默认的工具栏和菜单栏 -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- 设置苹果工具栏颜色 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
<meta name="format-detection" content="telphone=no, email=no" />
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化，主要是针对一些老的不识别divport的浏览器，比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC强制全屏 -->
<meta name="full-screen" content="yes">
<!-- QQ强制全屏 -->
<meta name="x5-fullscreen" content="true">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<!-- 适应移动端end -->
<title>订单列表</title>

<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/mobile/base.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/mobile/index.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/mobile/iconfont/iconfont.css" />
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/AjaxProxy.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MTools.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MGrid.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/layer/layer.js"></script>
</head>
<body>

	<div class="wrap" id="vuediv">
<!-- 		<header class="header"> -->
<!-- 			<h3>订单列表</h3> -->
<!-- 		</header> -->
		<div class="order_search">
			<div class="search_txt ">
				<i class="search_icon"></i> <input type="text" name="" id="orderNum" style="font-size: 1rem;"
					value="" placeholder="请输入订单编号" class="input_search" />
			</div>
		</div>
		<div class="list_bg"></div>
		<div v-if="items.length == 0" style="text-align: center;padding-top: 3%;"><span style="font-size: large">没有找到订单</span></div>
		<div class="order_list_content" v-for="order in items" @click="toOrderDetails(order.orderId)">
			<div class="order_title">
				<i class="order_icon iconfont"></i> <span class="title_cs">订单信息</span>
			</div>
			<div class="order_title">
				<span class="list_title">订单编号</span> <span class="list_info">{{order.orderNum}}</span>
			</div>
			<div class="order_title">
				<span class="list_title">酒店名</span> <span class="list_info">{{order.hotelName}}</span>
			</div>
			<div class="order_title">
				<span class="list_title">总数量</span> <span class="list_info">{{order.orderTotalNum}}</span>
			</div>
			<div class="order_title">
				<span class="list_title">总损耗</span> <span class="list_info">{{order.orderTotalLoss? order.orderTotalLoss : 0}}</span>
			</div>
			<div class="order_title">
				<span class="list_title">录入时间</span> <span class="list_info">{{MGrid.getTime(order.orderCreatetime)}}</span>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="${path }/resource/js/plugin/vue.min.js"></script>
	<script type="text/javascript">
		var vuediv = new Vue({
			el : '#vuediv',
			data : {
				items : []
			}
		});
	
		function toOrderDetails(orderId) {
			MTools.redirect("${path}/app/order/toOrderDetails?orderId=" + orderId);
		}
		
		function initList() {
			$.ajax({
				type : "post",
				url : "${path}/app/order/getOrderList",
				data : {
					orderNum : $("#orderNum").val()
				},
				dataType : 'json',
				async : false,
				success : function(result) {
					console.log(result);
					// 全局异常处理器发出的错误信息
					if (result.status == "ok") {
						vuediv.$data.items = result.rows;
					} else if (result.status == "user_invalid") {
						layer.msg(result.info, {
							icon : 2,
							time : 1000
						})
						setTimeout( 'MTools.redirect("${path}/app/user/toLogin")', 1500);
					} else {
						layer.closeAll('loading');
						layer.msg(result.info, {
							icon : 2,
							time : 1000
						});
						return null;
					}
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					layer.closeAll('loading');
					layer.msg("请求遇到问题-错误编号：" + XMLHttpRequest.status, {
						icon : 2
					});
					return null;
				},
			});
		}
		
		$(function() {
			initList();
		})
		
		$('i.search_icon').click(function() {
			initList();
		});
	</script>
</body>
</html>
